/**
 * @module vue-demo
 * @desc 路由文件
 * @author ervinewell on 2017/4/7.
 */

import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const renderRouteContainer = () => ({
  template: `<router-view></router-view>`,
});

/* 导入模块 */
const OrderList = () => System.import('./list/App.vue');
const OrderDetail = () => System.import('./detail/App.vue');

export default new VueRouter({
  routes: [
    {
      path: '/',
      component: renderRouteContainer(),
      children: [
        {
          path: 'list',
          component: OrderList,
        },
        {
          path: 'list/:number',
          component: OrderDetail,
        },
      ],
      beforeEnter: (to, from, next) => {
        next();
      },
    },
  ],
});

